#!/usr/bin/perl -w

#  
#  WinClip
#  
#     Copyright (C) 2011, Gowtham (gowthamgowtham@gmail.com)
#  
#     This program is free software; you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation; either version 2, or (at your option)
#     any later version.
#  
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
#  
#  

use strict;
use warnings;
use File::Path;
use File::Basename;
use File::Copy;

my $OUTDIR = "./installer";
my $VERSION = "1.11";
my $QTDIR = "d:\\Qt\\4.7.1";

my $INDIR = "f:\\Gowtham\\Documents\\Projects\\svn\\winclip";

my @QT_DLLS = qw( libgcc_s_dw2-1.dll mingwm10.dll QtCore4.dll
                  QTGui4.dll
                );

my @projectFiles = qw( release\\winclip.exe );
my %hash;

my $thisOutDir = "$OUTDIR\\WinClip $VERSION";
unless( -d $thisOutDir )
{
        unless( mkpath $thisOutDir )
        {
                die "Failed to create dir $thisOutDir : $!";
        }
}

foreach my $dll ( @QT_DLLS )
{
        my $dllFile = "$QTDIR\\bin\\$dll";
        $hash{$dllFile} = $thisOutDir;
}
foreach my $file ( @projectFiles )
{
        my $projectFile = "$INDIR\\$file";
        $hash{$projectFile} = $thisOutDir;
}
foreach my $infile ( keys %hash )
{
        my $target = $hash{$infile};
        if( -e $infile )
        {
                unless( copy $infile, $target )
                {
                        die "Failed to copy $infile to $target : $!";
                }
                else
                {
                        print "Copied $infile -> $target\n";
                }

        }
        else
        {
                die "No $infile found!";
        }

}


